<?php
include_once("../../php/include_all.php");
echo"
<form class='form-horizontal' id='prokeg'>
                            <div class='control-group'>
                                <label class='control-label' for='cari'>Cari Program</label>
                                <div class='controls'>
                                    <input type='text' id='cari' class='input-medium' name='cariPro'>
                                    <a class='btn btn-primary cariPro'><div id='loader' style='margin-top:2px'></div>Cari</a>
                                </div>
                            </div>
                            <div>
                                <h5>Program dan Kegiatan</h5>
                            </div>
                            <table class='table table-hover'>
                                <tbody id='program' name='program'>
                                    ";
                                    $program = get_datas("select * from mus_program");
                                    foreach ($program as $program) {
                                        $as = (($program['id_program'] % 2) == 0)?'#FCFDFF':'#C7E7FC';
										$cek1 = ($program['id_program'] == $_GET['idp'])?'checked':'';
										$classKeg = ($program['id_program'] == $_GET['idp'])?'list_keg keg_listed keg_open' : 'list_keg';
                                        ?><tr bgcolor="<?php echo $as;?>"><td>
                                                <div class="item_prog_<?php echo $program['id_program']; ?>">
                                                    <input type="radio" onClick="getData(<?php echo $program['id_program']; ?>)" name="optionsRadiosPro" id="optionsRadiosPro_<?php echo $program['id_program']; ?>" value=<?php echo "\"".$program['id_program']."\" $cek1";  ?>>
                                                    <?php echo $program['nama_program']; ?>
                                                    <div class="<?php echo $classKeg;?>">
                                                    <?php 
														if ((isset($_GET['ck']))&&($program['id_program'] == $_GET['idp'])){
														$idpro = $program ['id_program'];
														$kegiatan = get_data ("select * from mus_kegiatan where id_program=".$program['id_program']);
														$idkeg = $kegiatan ['id_keg'];
														$namakeg = $kegiatan ['nama_kegiatan'];
														$cek2 = ($kegiatan['id_keg'] == $_GET['idk'])?'checked':'';
															echo "<input type='radio' name='kegi' id='kegi' onclick='onclickKegiatan(this.value,$idpro)' value='$idkeg' $cek2>&nbsp;$namakeg</input>";
														}
													?></div>
                                                </div>
                                            </td>                                       
                                        </tr>
                                    <?php }
                                    ?>
                                </tbody>
                            </table>
                            <div>
                            	<h5>Program dan Kegiatan Lainnya</h5>
                                <table>
                                	<tr>
                                    	<td>                                        
                                            <textarea  class="input-xxlarge" rows="3" id="kegiatan" name="kegiatan" onKeyUp="kegiatanTambahan(this)"></textarea>					                                          
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </form>
<?php if ($_GET['idk'] == 0){?>
 <script type='text/javascript'>
 	var keg = $('#kTambahan').val();	
		$('#kegiatan').val(keg);
		
$('.cariPro').click(function(){
	var pro = $('#cari').val();
	source = "cari.php?pro=" + pro;
	var cobapro = $.get(source);
	cobapro.done(function(data){
		$('#program').html(data);
	});
});
 </script>

<?php } ?>